#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
using pii=pair<int,int>;
pii cnt[N];
int a[N],maxn;
int main()
{
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		cnt[a[i]].first++;
		cnt[a[i]].second++;
		maxn=max(a[i],maxn);
	}
	sort(a+1,a+1+n);
	int pre=0,rest=0;
	for(int i=1;i<=maxn;i++)
	{
		if(cnt[i].second&&cnt[i].first)
		{
			if(cnt[i].second>=rest)
			{
				n-=rest;
				cnt[i].second-=rest;
				rest=0;
				if(cnt[i].second<cnt[pre].first)
				{
					n-=cnt[i].second;
					cnt[pre].first-=cnt[i].second;
					cnt[i].second=0;
					rest+=cnt[pre].first;
				}
				else
				{
					n-=cnt[pre].first;
					cnt[i].second-=cnt[pre].first;
					cnt[pre].first=cnt[pre].second=0;
				}
			}
			else
			{
				n-=cnt[i].second;
				rest-=cnt[i].second;
				rest+=cnt[pre].first;
				cnt[i].second=0;
			}
			pre=i;
		}
	}
	cout<<n;
	return 0;
}
